package com.demo.task.di

import com.demo.task.config.Config.MQTT_SOCKET_IP
import com.demo.task.config.Config.MQTT_SOCKET_PORT
import com.demo.task.config.Config.WEB_SOCKET_IP
import com.demo.task.config.Config.WEB_SOCKET_PORT
import com.demo.task.socket.MqttManager
import com.demo.task.socket.RemoteInterface
import com.demo.task.socket.SocketIO
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.components.SingletonComponent
import javax.inject.Singleton

@InstallIn(SingletonComponent::class)
@Module
class SocketIOModule {
    @Singleton
    @Provides
    fun provideSocketIO(): RemoteInterface {
//        return SocketIO.Builder()
//            .url("http://$WEB_SOCKET_IP:$WEB_SOCKET_PORT")
//            .build()
        return MqttManager.Builder()
            .url("tcp://$MQTT_SOCKET_IP:$MQTT_SOCKET_PORT")
            .build()
    }
}